package com.triones.ljr.controller.api;

import cn.dev33.satoken.annotation.SaIgnore;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.triones.ljr.entity.dto.ComplaintDO;
import com.triones.ljr.entity.dto.IndustryCodeDO;
import com.triones.ljr.entity.vo.ComplaintCategoryVO;
import com.triones.ljr.service.ComplaintService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * api - 投诉建议
 *
 * @Author: triones
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/api/complaint")
public class ApiComplaintController extends BaseController {

    private final ComplaintService complaintService;

    /**
     * 新增
     * @return
     */
    @SaIgnore
    @PostMapping("/add")
    public R<Void> add(@Validated @RequestBody ComplaintDO dto) {
        complaintService.add(dto);
        return R.ok("操作成功");
    }

    /**
     * 获取投诉分类列表
     */
    @SaIgnore
    @GetMapping("/category/list")
    public R<List<ComplaintCategoryVO>> industryTreeList() {
        return R.ok(complaintService.getCategoryList());
    }
}
